#! bash
rm err_build_options
touch err_build_options

echo "START make clean; make test_build GCC=1   --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1   --silent 2>> err_build_options"
make clean; make test_build GCC=1   --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 NO_STATIC_ALLOC=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 NO_STATIC_ALLOC=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 NO_STATIC_ALLOC=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 PAPI=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 PAPI=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 PAPI=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG_CNC=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG_CNC=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG_CNC=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG_NUMA=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG_NUMA=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG_NUMA=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG_NUMA_MEM=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG_NUMA_MEM=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG_NUMA_MEM=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG_ET_DEPS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG_ET_DEPS=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG_ET_DEPS=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 VERBOSE=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 VERBOSE=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 VERBOSE=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 NO_PINNING=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 NO_PINNING=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 NO_PINNING=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 MEASURE_OVERHEADS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 MEASURE_OVERHEADS=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 MEASURE_OVERHEADS=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 ISOLATE_SEQ_OVERHEADS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 ISOLATE_SEQ_OVERHEADS=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 ISOLATE_SEQ_OVERHEADS=1  --silent 2>> err_build_options


echo "\nSTART make clean; make test_build GCC=1 DEBUG=1    --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG=1    --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG=1    --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG=1  NO_STATIC_ALLOC=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG=1  NO_STATIC_ALLOC=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG=1  NO_STATIC_ALLOC=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG=1  PAPI=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG=1  PAPI=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG=1  PAPI=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG=1  DEBUG_CNC=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG=1  DEBUG_CNC=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG=1  DEBUG_CNC=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG=1  DEBUG_NUMA=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG=1  DEBUG_NUMA=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG=1  DEBUG_NUMA=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG=1  DEBUG_NUMA_MEM=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG=1  DEBUG_NUMA_MEM=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG=1  DEBUG_NUMA_MEM=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG=1  DEBUG_ET_DEPS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG=1  DEBUG_ET_DEPS=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG=1  DEBUG_ET_DEPS=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG=1  VERBOSE=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG=1  VERBOSE=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG=1  VERBOSE=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG=1  NO_PINNING=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG=1  NO_PINNING=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG=1  NO_PINNING=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG=1  MEASURE_OVERHEADS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG=1  MEASURE_OVERHEADS=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG=1  MEASURE_OVERHEADS=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build GCC=1 DEBUG=1  ISOLATE_SEQ_OVERHEADS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build GCC=1 DEBUG=1  ISOLATE_SEQ_OVERHEADS=1  --silent 2>> err_build_options"
make clean; make test_build GCC=1 DEBUG=1  ISOLATE_SEQ_OVERHEADS=1  --silent 2>> err_build_options



echo "\nSTART make clean; make test_build CLANG=1   --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1   --silent 2>> err_build_options"
make clean; make test_build CLANG=1   --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 NO_STATIC_ALLOC=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 NO_STATIC_ALLOC=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 NO_STATIC_ALLOC=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 PAPI=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 PAPI=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 PAPI=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG_CNC=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG_CNC=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG_CNC=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG_NUMA=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG_NUMA=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG_NUMA=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG_NUMA_MEM=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG_NUMA_MEM=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG_NUMA_MEM=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG_ET_DEPS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG_ET_DEPS=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG_ET_DEPS=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 VERBOSE=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 VERBOSE=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 VERBOSE=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 NO_PINNING=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 NO_PINNING=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 NO_PINNING=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 MEASURE_OVERHEADS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 MEASURE_OVERHEADS=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 MEASURE_OVERHEADS=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 ISOLATE_SEQ_OVERHEADS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 ISOLATE_SEQ_OVERHEADS=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 ISOLATE_SEQ_OVERHEADS=1  --silent 2>> err_build_options


echo "\nSTART make clean; make test_build CLANG=1 DEBUG=1    --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG=1    --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG=1    --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG=1  NO_STATIC_ALLOC=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG=1  NO_STATIC_ALLOC=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG=1  NO_STATIC_ALLOC=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG=1  PAPI=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG=1  PAPI=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG=1  PAPI=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG=1  DEBUG_CNC=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG=1  DEBUG_CNC=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG=1  DEBUG_CNC=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG=1  DEBUG_NUMA=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG=1  DEBUG_NUMA=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG=1  DEBUG_NUMA=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG=1  DEBUG_NUMA_MEM=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG=1  DEBUG_NUMA_MEM=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG=1  DEBUG_NUMA_MEM=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG=1  DEBUG_ET_DEPS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG=1  DEBUG_ET_DEPS=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG=1  DEBUG_ET_DEPS=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG=1  VERBOSE=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG=1  VERBOSE=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG=1  VERBOSE=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG=1  NO_PINNING=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG=1  NO_PINNING=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG=1  NO_PINNING=1  --silent 2>> err_build_options

echo "\nSTART make clean; make test_build CLANG=1 DEBUG=1  MEASURE_OVERHEADS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG=1  MEASURE_OVERHEADS=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG=1  MEASURE_OVERHEADS=1  --silent 2>> err_build_options

echo "START make clean; make test_build CLANG=1 DEBUG=1  ISOLATE_SEQ_OVERHEADS=1  --silent 2>> err_build_options" >> err_build_options
echo "START make clean; make test_build CLANG=1 DEBUG=1  ISOLATE_SEQ_OVERHEADS=1  --silent 2>> err_build_options"
make clean; make test_build CLANG=1 DEBUG=1  ISOLATE_SEQ_OVERHEADS=1 --silent 2>> err_build_options

echo "NUMBER OF COMPILATION ERRORS THAT NEED FIXING (see err_build_options): "`grep error err_build_options | wc -l`
# This is only valid for my machine at Reservoir, adapt to your own if you want to use pedantic warnings (DEBUG=1)
echo "NUMBER OF PEDANTIC WARNINGS THAT NEED FIXING (see err_build_options): "`grep warning err_build_options | grep -v "/opt/intel/cnc/0.8/include/" | grep -v "unknown pragma ignored" | grep -v "ignoring \#pragma" | grep -v Ubuntu | grep -v "warning: ISO C99 requires rest arguments to be used" | grep -v "warnings generated" | grep -v "warning: must specify at least one argument for '...' parameter of variadic macro" | wc -l`